package cn.seqdata.jpa;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonIgnore;

@MappedSuperclass
public class JpaNoGeneratedObject extends JpaAuditableObject {
	private static final long serialVersionUID = 1L;

	public JpaNoGeneratedObject() {
		super();
	}

	public JpaNoGeneratedObject(Long id) {
		super(id);
	}

	public JpaNoGeneratedObject(Long id, String name) {
		super(id, name);
	}

	@Transient
	@JsonIgnore
	@Override
	public boolean isNew() {
		return null == getId();
	}

	@Id
	@Column(name = "id", unique = true, nullable = false)
	@Override
	public Long getId() {
		return id;
	}
}
